嗨,我是 Fly,用 Ruby 寫 Chatbot 並挑戰30天分享心得
為確保不會沒靈感
每日含 Ruby 解題增加內容
https://www.hackerrank.com/domains/tutorials/30-days-of-code
ns = gets.to_i
ns.times do |n|
odd = []
even = []
xs = gets.to_s.chomp
xs.split('').each_with_index do |x, index|
odd << x if index.odd?
even << x if index.even?
end
print "#{even.join} #{odd.join}\n"
end